home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Text Capture FKEY / End_copy.c < prev    next >
C/C++ Source or Header  |  1992-06-12  |  1KB  |  51 lines

  1. #include "defs.h"
  2. #define        CHECKPOINTS        0
  3. #include "debug.h"
  4.  
  5. void End_copy( void )
  6. {
  7.     WindowPtr    kludge;
  8.     Rect        kludge_bounds;
  9.     short        save_kind;
  10.     EvQElPtr    new_event;
  11.  
  12.     CKPT("End_copy start");
  13.         
  14.     /* Unpatch the StdText bottleneck. */
  15.     if (got_grafProcs)
  16.     {
  17.         DisposPtr( (Ptr)front->grafProcs );
  18.         front->grafProcs = NIL;
  19.     }
  20.     else
  21.         front->grafProcs->textProc = (ProcPtr) Old_StdText;
  22.     
  23.     /*
  24.         Stick the text on the clipboard.  Getting this to work in DA
  25.         windows, under both System 6 and 7, requires some trickery.
  26.     */
  27.     (void) ZeroScrap();
  28.     TESetSelect( 0, 32767, text_h );
  29.     TECopy( text_h );
  30.     save_kind = ((WindowPeek)front)->windowKind;
  31.     ((WindowPeek)front)->windowKind = 2;
  32.     SystemEdit( 3 );
  33.     ((WindowPeek)front)->windowKind = save_kind;
  34.     /*
  35.         Fake an activate event to make the new scrap information be
  36.         adopted into a private scrap.
  37.     */
  38.     if (fake_activate)
  39.     {
  40.         PPostEvent( activateEvt, (long) front, &new_event );
  41.         new_event->evtQModifiers = activeFlag;
  42.     }
  43.     
  44.     /* Get rid of the TE structure and GrafPort. */
  45.     TEDispose( text_h );
  46.     ClosePort( text_port );
  47.     DisposePtr( (Ptr)text_port );
  48.  
  49.     Unpatch();
  50.     CKPT("End_copy end");
  51. }